﻿using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using System.Linq;
using Model.Domain_Model;
using Interfaces.Delete_Interfaces;
using Presenters.Delete_Presenters;
using Views.Status_Views;

namespace Views.Delete_Views
{
    public partial class ClientDeleteView : Form, IClientDeleteView
    {
        ClientDeletePresenter presenter = null;

        public ClientDeleteView()
        {
            InitializeComponent();
            presenter = new ClientDeletePresenter(this);
        }

        T Interfaces.Inherited_Interfaces.IView.ReturnView<T>()
        {
            return (T)((object)this);
        }

        void Interfaces.Inherited_Interfaces.IError.ShowError()
        {
            presenter.ShowError(new ErrorView());
        }

        void Interfaces.Inherited_Interfaces.ISuccess.ShowSuccess()
        {
            presenter.ShowSuccess(new SuccessView());
        }

        void Interfaces.General_Interfaces.IParamable.SetParams(params object[] param)
        {
            presenter.client = (Client)param.Where(x => x.GetType() == typeof(Client)).Take(1).FirstOrDefault();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            presenter.Delete();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            presenter.ExitApp();
        }

        void Interfaces.Inherited_Interfaces.ICloseable.Close()
        {
            this.Close();
        }

        private void toolStripLabel1_Click(object sender, EventArgs e)
        {
            presenter.ExitApp();
        }
    }
}
